<?php
require_once(OC_App::getAppPath('company') . "/lib/quota.php");

$LoginStats = PUtil::checkUserLogin(true);
if ($LoginStats !== true) {
   echo $LoginStats;
   exit();
}

OCP\JSON::callCheck();

$order_id = JRequest::getInt('order_id', 0);
$action = JRequest::getString('action', '');

if ($order_id && $action == 'cancel_order') {
   $model = new PCompanyModelQuota();
   
   if($model->setOrderStatus($order_id, 0)) {
      OCP\JSON::success();
   } else {
      OC_JSON::error(array('data' => array( 'message' => $model->getError() ? $model->getError() : '系统错误')));
   }
} else {
   OC_JSON::error(array('data' => array( 'message' => '非法操作')));
}
